<?php
class PesanMain{
  var $procDir='com/pengumuman/process/';
  var $procObj;
  //var $params=array();
  
  public function PesanMain($act,$params){
    $this->loadProcess('ProcessPesan.class.php');
    $this->procObj=new ProcessPesan();
    $this->params=$params;
    $this->addAction($act);
  }
  
  function loadProcess($processFile){
    if(file_exists($this->procDir.$processFile)){
       require($this->procDir.$processFile); 
    }else{
      print('Process File '.$this->procDir.$processFile.' Not Exist');
    }   
  }
  
  function addAction($act=""){
    switch($act){
      case "getPesanByPenerima":
         $this->procObj->getPesanByPenerima($this->params[0]);
      break;
      case "getPesanByPengirim":
         $this->procObj->getPesanByPengirim($this->params[0]);
      break;
      case "getPesanById":
         $this->procObj->getPesanById($this->params[0]);
      break;
      case "doAddPesan":
         $this->procObj->doAddPesan($this->params[0],$this->params[1],$this->params[2],$this->params[3],$this->params[4]);
      break;
      default:
        die('Function '.$act.' Not Declare');
      break;
    }
  }
}
?>
